package com.djx.plus.config;

import com.djx.plus.inter.PermissionInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author dingjunxiong
 * @date 2021/10/11 19:03
 */
//@Configuration
public class WebConfigurer implements WebMvcConfigurer {
    @Autowired
    private PermissionInterceptor permissionInterceptor;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(permissionInterceptor)
                //放开拦截
                .excludePathPatterns("/api/**", "/oauth2/**", "/user-auth/**")
                //拦截
                .addPathPatterns("/**");
    }
}
